Repository navigation
fix(ci): run the JS examples with vitest - #925
Merged
Merged
Conversation
The JS SDK replaced jest with vitest in its examples package. So npx jest found no jest package, and the js-examples job failed. The harness now runs vitest when the examples package has no jest.config.integration.js. It still runs jest for an older JS ref that has that config. Both runners write the same JSON fields, so result parsing and reporting do not change. --test-args replaces --jest-args. --jest-args still works.
This comment has been minimized.
This comment has been minimized.
hln33
previously approved these changes
Nov 10, 2026
A test now checks that only jest gets --experimental-vm-modules in NODE_OPTIONS. It fails when the runner check is inverted. The new --test-args option is removed. The harness keeps --jest-args, which now passes arguments to whichever runner it picks. So the PR adds no CLI option.
hln33
approved these changes
Nov 10, 2026
Contributor
Codex AI reviewOne prior P2 approach finding remains at Suppressed repeats
Reviewed commit |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available
None. The
js-examplesjob has failed onmainsince 2026-11-09. Its last pass was on 2026-11-02.Description of changes
What
The JS examples harness (
.github/scripts/js_examples/run.py) now runs the JS SDK's example tests with vitest. It still runs jest for a JS ref that predates the move to vitest.Why
npx --no-install jestand read jest's JSON results."test:integration": "NODE_ENV=integration vitest run"and the devDependencyvitest ^5.1.0. It has no jest package and nojest.config.integration.js.npxstopped withnpx canceled due to missing packages ... ["jest@30.5.2"].jest wrote no results to .../jest.json.Change
detect_test_runner()returnsjestwhen the examples package hasjest.config.integration.js. Otherwise it returnsvitest.runner_command()builds the command for the detected runner. The jest command is unchanged.NODE_OPTIONS=--experimental-vm-modulesonly for jest. vitest does not need it.--test-argspasses extra arguments to the runner. The old name,--jest-args, still works.vitest.json, orjest.jsonfor an old ref. Retry files keep the nameretryN.json.The jest flags map to vitest as follows.
--config jest.config.integration.jsvitest.config.ts. That config readsNODE_ENV=integration, which the harness already sets.testMatch: src/examples/**/*.test.tsinclude: src/examples/**/*.test.tstestNamePattern: "cloud"testNamePattern: "cloud"testTimeout: 120000testTimeout: 120000--bail=0over configbail: true--bail=0over configbail: 1--maxWorkers=N--maxWorkers=NmaxWorkers: 16whenCIis set. The CLI value overrides it. The JS config also setspool: "threads".--json --outputFile=F--reporter=default --reporter=json --outputFile.json=F--runTestsByPath P...P...NODE_OPTIONS=--experimental-vm-modulesimport().vitest.setup.tsfrom the config_X_AMZN_TRACE_ID. The harness passes nothing.The environment the tests read is unchanged:
NODE_ENV=integration,LAMBDA_ENDPOINTandFUNCTION_NAME_MAP. Test selection, thelocalOnlyandotel/exclusions, the invoke proxy, the Lambda shim, retries,report.jsonand the exit codes are unchanged. Thereport.jsonkeyjest_exit_errorskeeps its name, so readers of the report need no change.Old JS refs
The workflow has a
js_refinput, andrun.pyhas--js-refand--js-dir. So a run can build a JS commit from before aws/aws-durable-execution-sdk-js#1167. Such a commit hasjest.config.integration.jsand runs only with jest. Supporting both runners costs one file check and oneifin the command builder. The jest command is the existing code, moved into a function. So the harness supports both runners. The README section "A failure caused by a JS change" relies on runs against older JS commits, so this keeps that procedure working across the change.Design
--test-args.--js-refrun against a JS commit before 2026-11-03 would then fail. Runs against an older JS commit are the README's procedure to tell a Python regression from a JS change. So the PR keeps jest support.npx jest.run.py+119/-50, README +17/-11,invoke_proxy.py+1/-1, tests +105/-3. No public API change. The harness gains the--test-argsoption.Assumptions
outcomes()reads:testResults[].name(the absolute file path),testResults[].status(passedorfailed) andassertionResults[].status. Evidence: theJsonReporterclass in vitest 5.1.0, the version in the JS lockfile. A skipped test has the statusskipped. jest usedpending.outcomes()treats any status other thanpassedorfailedas skipped, so both work.filterTestFiles()in vitest 5.1.0. Every selected path starts withsrc/examples/. So a selected path can also match another file only if that file's path contains the whole selected path. No examples path does that today. The full run below reported exactly the 115 selected files.--bail=0on the command line overridesbail: 1in the config. Evidence: a run with--test-args='--testTimeout=1'on the 14wait-for-callback/files. All 14 files ran, and all 17 tests failed, in both the first run and the retry. Withbail: 1, vitest would have stopped the run after the first failed test.Decisions not covered by the issue or the design note
--test-argsis the new option name, because the arguments now go to vitest.--jest-argsstays as an alias, so existing commands keep working.vitest.json), because the file holds that runner's output.Testing
mainat ca59e68, as CI runs it:hatch run dev-testing:js-examples --js-dir <js checkout> --out <dir>, withCI=true, hatch 1.16.5 and Node.js 24. Result: 115 test files selected, 112 passed (0 on retry), 0 failed, 3 have no cloud tests, 0 not run. 6localOnlyfiles were skipped. vitest reported 136 tests passed and 10 skipped, in 119 s. Exit status 0.main:--test-args='--testTimeout=1' wait-for-callback/. Result: 14 files selected, 14 failed, then retried, then reported as FAIL. Exit status 1.step/against JS commit 21074ed, the parent of the vitest change. The harness detected jest and wrotejest.json. Result: 9 files selected, 7 passed, 0 failed, 2 have no cloud tests. Exit status 0.hatch run dev-testing:python -m pytest .github/scripts/tests/test_js_examples.py: 70 passed. New tests cover the runner detection, the vitest and jest commands, the--test-argsand--jest-argsoptions, and parsing of a vitest json result.hatch fmt --check(hatch 1.16.5, ruff 0.13.2) on the 3 changed Python files: passed.test_jest_args_are_splitbecametest_test_args_are_split. It now readsargs.test_args, because the option's destination changed. It runs once with--test-argsand once with--jest-args.Checklist
runner_command()anddetect_test_runner(), which the current code does not have.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.